package com.wing.cabinet.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 盘验结果生成的订单
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_checked_result_order")
public class CheckedResultOrder extends BaseEntity<CheckedResultOrder> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 已创建
        */
        created(0,"已创建"),
        /**
        * 已通知
        */
        notified(1,"已通知");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum BusinessType implements IEnum<Integer> {

        /**
        * 暂存
        */
        temp(1,"暂存"),
        /**
        * 维修
        */
        repair(2,"维修"),
        /**
        * 回收/报废
        */
        recycle(3,"回收/报废");

        private int code;
        private String desc;

        BusinessType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 货物状态
     */
    private BusinessType businessType;

    /**
    * 货物状态描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        return businessType == null ? null : businessType.getDesc();
    }

    /**
     * 盘验数量
     */
    private Integer quantity;

    /**
    * 通知时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime notifyTime;

    /**
     * 通知用户
     */
    private Long notifyUserId;

    /**
     * 序号
     */
    private Integer no;

    /**
     * 日期
     */
    private Integer day;

    /**
     * 编号
     */
    private String code;

    /**
     * 通知人
     */
    private String notifyUserName;

    /**
     * 通知供应商id
     */
    private Long supplierId;

    /**
     * 通知供应商
     */
    private String supplierName;

    /**
     * 供应商对应的企业id
     */
    private Long companyId;


    /**
     * 物流联系人
     */
    private String logisticsContact;

    /**
     * 收货联系人
     */
    private String receiveContact;

    /**
     * 联系电话
     */
    private String phone;

    /**
     * 维修费用
     */
    private BigDecimal price;

    /**
     * 物流单号
     */
    private String expressNo;


    /**
     * 收货人地址
     */
    private String addr;

    public enum IsSync implements IEnum<Integer> {

        /**
         * 未同步
         */
        no(0,"未同步"),
        /**
         * 已同步
         */
        yes(1,"已同步");

        private int code;
        private String desc;

        IsSync(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }
    private CheckedResultOrder.IsSync isSync;

    private String uniqCode;

    private Long supplierCompanyId;

    /**
     * 企业编码
     */
    private String enterpriseCode;
    /**
     * 渠道编号
     */
    private String channelCode;
}
